use actix_web::web;
use serde::{Deserialize, Serialize};

// 实现 反序列化、序列化 的trait serde提供的功能
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Runner {
    pub code: String,
    pub input: String,
}

// 将jaso格式的请求转化为Runner这个类
impl From<web::Json<Runner>> for Runner {
    fn from(runner: web::Json<Runner>) -> Self {
        Runner {
            code: runner.code.clone(),
            input: runner.input.clone(),
        }
    }
}


#[derive(Serialize)]
pub struct ResponseObj {
    pub out: String,
}